﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IoTCM
{
    public class DataValueCollection : IEnumerable<DataValue>
    {
        private List<DataValue> m_values;

        public string Instance { get; private set; }
        public DateTime Timestamp { get; private set; }

        public DataValueCollection(string instance, DateTime timestamp)
        {
            Instance = instance;
            Timestamp = timestamp;

            m_values = new List<DataValue>();
        }

        public void Add(DataValue value)
        {
            m_values.Add(value);
        }

        public void AddRange(IEnumerable<DataValue> values)
        {
            m_values.AddRange(values);
        }

        public DataValue this[int index]
        {
            get { return m_values[index]; }
        }

        public int Count
        {
            get { return m_values.Count;  }
        }

        public IEnumerator<DataValue> GetEnumerator()
        {
            return m_values.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}
